#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "skill_data.pb.h"
#include "google/protobuf/message.h"

using namespace DataConfig;

int main(int argc, const char **argv) {
    SKILL_DATA_ARRAY* res_array = new SKILL_DATA_ARRAY();

    int fd = open("./skill_data.bin", O_RDONLY);
    if (fd < 0) {
        printf("open failure, error<%d:%s>.", errno, strerror(errno));
        return -1;
    }

    bool ok = res_array->ParseFromFileDescriptor(fd);
    close(fd);

    if (!ok) {
        printf("protobuf loading failure, file: .\n");
        return -1;
    }

/*    for (int i = 0; i < res_array_->items_size(); ++i) {*/
        //const res_type& res = res_array_->items(i);
        //key_type key = make_key(res);
        //assert_continue(res_map_.find(key) == res_map_.end());

        //res_map_[key] = &res;
    //}


    return 0;
}
